New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expose user blocking in the admin UI #4363
Conversation
e27fc7e
to
11c5910
Compare
a513935
to
d9453db
Compare
Maybe we can use a smaller size for the button there? |
d9453db
to
f28d5a0
Compare
f28d5a0
to
32e84f3
Compare
indico/modules/users/controllers.py
Outdated
class RHUserBlock(RHUserBase): | ||
def _process_PUT(self): | ||
self.user.is_blocked = True | ||
logger.info("User %s blocked %s", session.user, self.user) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for being nitpicky but we usually use single quotes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No problem! I thought the linter was picking this up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does flake8 have a plugin which can check for this (single quotes, unless it would require escaping inside)? But even if it does, I think it'd require quite a few changes in existing files for English strings where we defaulted to double quotes for a while even if there were no apostrophes inside.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something like this?
https://pypi.org/project/flake8-quotes/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh nice, this looks great! I just gave it a try and with some configuration it works pretty well to avoid stuff like unnecessary escapes.
unfortunately the "wrong type of quotes" check isn't really suitable for us:
$ flake8 indico/ | grep Q000 | wc -l
1366
a bit better for multiline strings, but that's more because we don't have that many which aren't docstrings..
$ flake8 indico/ | grep Q001 | wc -l
138
and even better when ignoring it for indico/core/signals/
since the multiline strings there are basically docstrings (and thus double quotes are more appropriate).
$ flake8 indico/ | grep Q001 | wc -l
34
But I don't think it really matters for multiline strings, so I'm inclined to disable Q000 and Q001 globally and just let it complain about unnecessary escapes and docstrings not using double-quotes.
Too bad there's no way to run this check just for newly added code...
(and no, I don't want to update those 1.3k occurrences of double quotes, even if there's probably some tool that can automate it)
c5e9c7f
to
e0c461f
Compare
e0c461f
to
de61b5c
Compare
@@ -402,7 +402,7 @@ def _process(self): | |||
external = form_data.pop('external') | |||
form_data = {k: v for (k, v) in form_data.iteritems() if v and v.strip()} | |||
matches = search_users(exact=exact, include_deleted=include_deleted, include_pending=include_pending, | |||
external=external, allow_system_user=True, **form_data) | |||
include_blocked=True, external=external, allow_system_user=True, **form_data) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the admin search, I'm just including the blocked users by default because we already have way too many options and a label will be shown anyway. Nonetheless, I will leave this thread for change requests if anyone disagrees.
5c4deb2
to
868e24d
Compare
868e24d
to
4e364dd
Compare
Most of Indico's ui components use legacy custom CSS instead of the semantic ui elements. Since this branch will introduce some new in the user profile, it will also update this whole section elements for consistency towards a gradual conversion.
This commit will add a new endpoint DELETE/PUT for user un/blocking and exposes an ui button for the corresponding action. Labels that reflect user properties were also added to the admin list.
The introduction of sui elements (mainly buttons) in the user profile and the difference in their sizes caused the list items to lose their alignment. This commit refactors them to re-use previously declared flexbox css styles. Closes indico#4376.
4e364dd
to
a90aa5e
Compare
Closes #3243
This PR will expose the endpoint and UI ability to block/unblock users, and:
when viewing their profileand maybe also in the user search resultsSide-effects
Since this commit used some semantic-ui raw elements, I took the opportunity to upgrade most of the previous custom CSS within the user profile section. These include, but not limited to, toggles, buttons and header panels (alignment refactoring only).